#ifndef __CONTROL_H
#define __CONTROL_H

#include "stm32h7xx.h"
#include "stm32h7xx_hal.h"

#define CORRECT_ANGLE   1
#define CORRECT_EDGE    0

#define CORRECT_MODE    1 /* 閫夋嫨淇?姝ｆā寮?: 1.闄€铻轰华瑙掑害淇?姝?; 0.杈规部姝ヨ繘淇?姝? */

#define CORRECT_RIGHT   7
#define CORRECT_LEFT    8

#define DELAYTIME_WHEEL_LINE     ((((float)(autoLineWidth * 40) / (float)(autoCarVelocity))) * 1000)
#define DELAYTIME_WHEEL_STRAIGHT ((((float)(autoLineWidth * 40) / (float)(autoCarVelocity)) + 3) * 1000)
#define DELAYTIME_WHEEL_TURN     ((((float)(sideswayWidth * 40) / (float)(autoCarVelocity)) + 3) * 1000)
#define DELAYTIME_SCAN           (((float)scanWidth / (float)scanVelocity) * 1000)

typedef enum
{
    CORRECTSTOP,
    CORRECTFRONT,
    CORRECTBACK,
}correct_status;

typedef enum
{
    FRONT_LEFT = (1 << 0),
    BACK_LEFT = (1 << 1),
    FRONT_RIGHT = (1 << 2),
    BACK_RIGHT = (1 << 3),
}sensor_t;

void set_velocity(uint32_t id,int16_t vel, int16_t torque);
void logic_control(void);
void manual_run(void);
void auto_run(void);
void other_func(void);
void angle_poll(void);
#endif

